package Q3;

import java.util.Scanner;

public class Main {

    public static int n; //总人数
    public static int k; //选的人数
    public static int d; //差值
    public static int[] arr; //能力值
    public static long ret;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        n = scanner.nextInt();
        k = scanner.nextInt();
        d = scanner.nextInt();
        arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        dfs(0, new int[k], 0);

        System.out.println(ret);
    }

    /**
     *
     * @param index
     * @param choice
     * @param count 已经选的人数
     */
    public static void dfs(int index, int[] choice, int count) {
        if (count == k) {
            long sum = 1;
            for (int i = 0; i < k; i++) {
                sum *= choice[i];
            }
            ret = Math.max(ret, sum);
            return;
        }

        if (index == n) {
            return;
        }

        for (int i = index; i < n; i++) {
            //选
            if ((count > 0 && arr[i] - arr[count - 1] <= d) || count == 0) {
                choice[count] = arr[i];
                dfs(i + 1, choice, count + 1);
                //回溯
                choice[count] = 0;
            }

            //不选
            dfs(i + 1, choice, count);
        }
    }
}
